<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%--资质转让页面--%>
<form id="myTransferForm">
<div class="body-main">
    <div id="makeOver">
        <table class="add-table form-table">
            <tbody>
            <tr>
                <th><span class="required">转让价格（元）：</span></th>
                <td>
                    <input type="text" maxlength="12" class="input-style" name="qualificationNewPrice" id="qualificationNewPrice" onblur="checkApplicationMoney()">
                </td>
            </tr>
            <tr>
                <th><span class="required">审核人：</span></th>
                <td>
                    <select class="select-style" id="currentAuditerId" name="currentAuditerId">
                        <option value="">请选择</option>
                        <c:forEach var="p" items="${userList}">
                            <option value="${p.id}">${p.realName}${p.loginName}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <th><span class="required">转让后所属企业：</span></th>
                <td>
                    <input type="text" maxlength="200" class="input-style" name="makeOverCompany" id="makeOverCompany" >
                </td>
            </tr>
            </tbody>
        </table>
    </div>

</div>
</form>

<script type="text/javascript">
    //校验使用价格
    function checkApplicationMoney() {
        isFloatRangeSam('#qualificationNewPrice',0,999999999);
    }


    function comfirmApplicationTransfer(certificateId, scOrderId) {//证书ID 和  生产ID
        var qualificationNewPrice = $('#qualificationNewPrice').val();
        if (checkIsEmpty(qualificationNewPrice)){
            DGG.Warning("请输入转让价格!");
            return;
        }
        var currentAuditerId = $('#currentAuditerId').val();
        if (checkIsEmpty(currentAuditerId)){
            DGG.Warning("请选择审核人!");
            return;
        }
        var makeOverCompany = $('#makeOverCompany').val();
        if (checkIsEmpty(makeOverCompany)){
            DGG.Warning("请输入转让后所属企业!");
            return;
        }
        if (!isFloatRangeSam('#qualificationNewPrice',0,999999999)) {
            return;
        }
        var serializeObject = $('#myTransferForm').serializeObject();
        serializeObject.certificateId=certificateId;
        serializeObject.scOrderId=scOrderId;
        // var fmtMoney = fmtMoney(qualificationNewPrice);  ??
        DGG.Confire('确认以'+qualificationNewPrice+'(元)的价格申请转让吗？','资质转让提示',function() {
                DGG.loading();
                $.ajax({
                    type: 'POST',
                    data: serializeObject,
                    url: sysInfo.basePath + '/zzsc/inprocess/save_application_transfer.do',
                    dataType: 'JSON',
                    success: function (data) {
                        DGG.loading('close');
                        if (data.code != 0) {
                            DGG.Errors(data.msg);
                        } else {
                            DGG.Succeed("操作成功!");
                            layer.closeAll();
                            window.location.reload();
                        }
                    },
                    error: function () {
                    }
                });
            })


    }
</script>

